package com.tedu;

import com.tedu.pojo.User;
import com.tedu.web.UserServlet;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class SpringTest {
    public static void main(String[] args) {
        // 模拟  用户的登录
        //启动spring
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("spring.xml");

        //从spring容器中，获取UserServlet对象
        UserServlet bean = applicationContext.getBean(UserServlet.class);
        User login = null;
        try{
            login = bean.login();
        }catch (Exception e){
            e.printStackTrace();
        }

        System.out.println(login);
    }
}
